<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/fuman/css/style.default.css" type="text/css" />
<script type="text/javascript" src="/fuman/js/plugins/jquery-1.7.min.js"></script>
<script type="text/javascript" src="/fuman/js/alertAts.js"></script>
<script language="javascript">
 function gotoNextObjForWeight(obj,sid,e){
   var keyCode;
   if(window.event){
      keyCode=event.keyCode;
   }else{
      keyCode=e.which;
   }
   document.getElementById("orderweight").value = document.getElementById("orderweight").value.replace(/[ ]/g,"");

	if(keyCode==13){//如果按了回车键
	    $("#showorderdetail").html("");
		if(document.getElementById(obj) != null){
			$("#showorderdetail").html("");
			$("#orderid").focus();
			//document.getElementById(obj).focus();
		}else{ 
			alert("控件不存在,操作失败");
		}
	}
}
function checkOrder(sid){
   document.getElementById("orderweight").value = document.getElementById("orderweight").value.replace(/[ ]/g,"");
}
//检测参数是否为金钱
function ifMoney(str)
{
   slen=str.length;
   if(slen<=0){return false;}
   var money = str.replace(".","");//替换小数点(仅替换1个)
   if(ifDigit(money) == false){//非数字
      return false;
   }
   return true;
}
//检测参数是否为数字
function ifDigit(str)
{
   slen=str.length;
   for (i=0; i<slen; i++){
      cc = str.charAt(i);
      if (cc <"0" || cc >"9")
      {
         return false;
      }
   }
   return true;
}

function gotoNextObj(obj,e){
   var keyCode;
   if(window.event){
      keyCode=event.keyCode;
   }else{
      keyCode=e.which;
   }
	if(keyCode==13){
		if(document.getElementById(obj) != null){
			document.getElementById(obj).focus();
		}else{ 
			alert("控件不存在,操作失败");
		}
	}
}

//close msgbox
document.onkeydown=function(ev){
	var oEvent=ev||event;//获取事件对象(IE和其他浏览器不一样，这里要处理一下浏览器的兼容性event是IE；ev是chrome等)
	//Esc键的keyCode是27
	if(oEvent.keyCode==27){//按ESC键
		 $("#alertMsg").remove();
		 $("#shadowDiv").remove();
	}
}
		
function checkInfo4(e){
	var keyCode;
   if(window.event){
      keyCode=event.keyCode;
   }else{
      keyCode=e.which;
   }
    if(keyCode==13){
		   var numall = $("#numall").val();
	       $("#numall").attr("value",Number(numall)+1); 
		 var orderweight=$("#orderweight").val();
	  if(orderweight.length <= 0){
         alert('请输入包裹重量');
         $("#orderweight").focus();
         return false;
      }
      if(ifMoney(orderweight) == false){
         alert('包裹重量须为数字');
		 $("#orderweight").attr("value","0");
         $("#orderweight").focus();
         return false;
      }
	  var orderid=$("#orderid").val();
      if(orderid.length <= 0){
         alert('请输入订单编号');
         $("#orderid").focus();
         return false;
      }
      var expressid=$("#expressid").val();
      if(expressid.length <= 0){
         alert('请输入包裹单号');
         $("#expressid").focus();
         return false;
      }
	  
		 $.post("/orderlist/ajaxbutton", {"op": "ActionbatchExpress", "orderid": orderid, "expressid": expressid, "orderweight": orderweight,"ost":Math.random()},
		function (data) {
			if(data.code == 201)
			{
				//alert(data.txt);
				alertMsg(data.txt, '')
				$("#orderweight").val('');
				$("#orderid").val('');
				$("#expressid").val('');
				$("#orderweight").focus();
				return false;	
			}
			if(data.code == 200)
			{
				$("#showorderdetail").html(data.txt);
				$("#memo").append(data.memo);
				$("#orderweight").val('');
				$("#orderid").val('');
				$("#expressid").val('');
				$("#orderweight").focus();
				return true;	
			}
			
			
		}, "json");
	  
	  /*
	  var data= "包裹重量:"+orderweight;
	  	  data+="订单编号"+orderid;
		  data+="交运单号"+expressid;
		$("#showorderdetail").html(data);
	   $("#orderweight").val('');
	   $("#orderid").val('');
	   $("#expressid").val('');*/
	   
			  
	}
   
 }

</script>
<style type="text/css">
        #alertMsg {
            display: none;
            width: 400px;
            border: 1px solid #ddd;
            border-radius: 5px;
            box-shadow: 1px 1px 10px black;
            padding: 10px;
            font-size: 24px;
            position: absolute;
            text-align: center;
            background: #fff;
            z-index: 100000;
        }

        #alertMsg_info {
            padding: 2px 15px;
            line-height: 1.6em;
            text-align: left;
        }

        #alertMsg_btn1, #alertMsg_btn2 {
            display: inline-block;
            background: url(images/gray_btn.png) no-repeat left top;
            padding-left: 3px;
            color: #000000;
            font-size: 12px;
            text-decoration: none;
            margin-right: 10px;
            cursor: pointer;
        }

        #alertMsg_btn1 cite, #alertMsg_btn2 cite {
            line-height: 24px;
            display: inline-block;
            padding: 0 13px 0 10px;
            background: url(images/gray_btn.png) no-repeat right top;
            font-style: normal;
			 font-size: 14px;
        }

    </style>
<title>批量发货</title>
<body class="withvernav">
<div class="bodywrapper">

<!--pageheader-->
 <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
    <thead>
      <tr>
        <th colspan="2" class="head1">批量发货</th>
      </tr>
    </thead>
  </table>
  <table border="0" width="100%" id="table19" class="stdtable" cellspacing="0" cellpadding="0">

   <tr>
      <td width="60%">
      <div id="contentwrapper" class="contentwrapper">
            <div id="basicform" class="subcontent">
                <form class="stdform stdform2" id="otherForm" method="post" enctype='multipart/form-data'
                      action="/product/ajaxbutton?op=savenewproduct">

                    <p>
                        <label>当前扫货数 </label>
                            <span class="field">
                            <input id="numall" name="numall" value='0' style="font-size:40px; height:50px;width:120px" readonly/><font color="#FF0000"> 不分成功和失败</font></span>
                    </p>
                    <p>
                        <label>称重与预估重量差额比<br><font color=red>(预留功能)</font></label>
                            <span class="field">
                          <input type=text name="weightflag" id="weightflag" value="0" style="font-size:20px; height:30px;width:50px"><strong style="font-size:20px;">%</strong><br><font color="#FF0000">此功能可以找出包错货或数量不正确的订单，如不需要此功能，请填0或不填</font></span>
                    </p>
                    
                    <p>
                        <label> 包裹重量:</label>
                            <span class="field">
                         <input type="text" onFocus="this.select();this.value=''"  id="orderweight" name="orderweight" value="" size=16 onKeyPress="gotoNextObjForWeight('orderid','4',event);" onChange="checkOrder('4');" style="font-size:40px; height:50px;width:200px"><font color="#FF0000">(*)</font><br></span>
                    </p>
                    
                    <p>
                        <label> 订单编号:</label>
                            <span class="field">
                         <input type="text" id="orderid" onFocus="this.select()" name="orderid" value="" size=6 onKeyPress="gotoNextObj('expressid',event);" style="width:220px"><font color="#FF0000">(*)</font><br></span>
                    </p>
                  	
                    <p>
                        <label> 交运单号:</label>
                            <span class="field">
                         <input type="text" id="expressid" onFocus="this.select()" name="expressid" value="" size=16 onKeyPress="checkInfo4(event);" style="width:220px"><font color="#FF0000">(*)</font><input type="hidden" id="currentflag" name="currentflag" value="0"/></span>
                    </p>
                   
                   
                
                    <p>
                        <label>配送信息</label>
                            <span class="field">
                       <textarea name="memo" id="memo" cols="8" rows="8"></textarea>
                            </span>
                    </p>

                    <p class="stdformbutton">
                        	<span><input name="open2" type="button" value="处理结果" onClick="window.open('/order/ajaxbutton?op=scanorderlist');"/></span>
                        <span class="btn_style10"><input name="save2" type="button" value="关闭" onClick="window.close();"/></span>
                    </p>
                </form>

                <br/>

            </div><!--subcontent-->

            <!--subcontent-->

        </div><!--contentwrapper-->
	</td>
    <td width="40%" valign="top">
         <div id="showorderdetail" style="width:100%; height:430px; border: 1px solid #e3e3e3; background:#e3e3e3; font-size:30px; font-weight:900;line-height:40px;">
         </div>
      </td>
   </tr>
</table>

</div>

  
  
  <!-- /.modal -->
</body>
</html>